This problem has a variety of solutions, as such the output files given are just one possible valid solution, except for cases where no solution exists.

To deal with this, we use a custom checker system that dynamically evaluates whether the given output is correct or not.

To use the custom checker, you must compile it:

g++ checker.cpp -o checker

Then, you can run it as follows:

./checker {input file} {your output file} {correct output file}

Please note that the checker does rely on the correct output file to determine whether a solution exists or not, so the parameter is needed for proper usage of the checker.

You can then check the exit code of the checker for whether you have AC'd or not:

echo $?

If the exit code is 0, then your answer is correct.

If this is too complicated, we recommend that you instead submit your code to one of the online judges that has uploaded the problem:

https://mcpt.ca/problem/ecoo21p4
https://dmoj.ca/problem/ecoo21p4